#pragma once

#include <cv.h>
#include <cxcore.h>
#include <highgui.h>

class CCamShift
{
public:
	CCamShift();
	~CCamShift(void);

public:
	void InitCamShift(IplImage *pImage);
	CvHistogram *CreateHist();
	void ReleaseHist(CvHistogram *pHist);
	CvRect GetCamShiftPos(CvHistogram *pHist,IplImage *pImage,CvRect ObjRect);
	CvHistogram * CalcHist(CvHistogram *pHist,IplImage *pImage,CvRect ObjectInitWindow);

private:
	CvRect CorrectRect(CvRect A,CvRect B);

private:
	int                iSearchRegion;

	IplImage       *pMask;
	IplImage       *pBackProject;
	IplImage       *pHPlane;    
	IplImage		*pHSVImg;
};
